//
//  ZSForgetPasswordViewController.m
//  ZhuShou
//
//  Created by Dejun Liu on 15/10/29.
//  Copyright © 2015年 jw. All rights reserved.
//

#import "ZSForgetPasswordViewController.h"

@interface ZSForgetPasswordViewController ()
@property (weak, nonatomic) IBOutlet UITextField *emailTextField;

@end

@implementation ZSForgetPasswordViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"重置密码";
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (IBAction)submit:(id)sender {
    
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params hs_setSafeValue:@"email" forKey:@"type"];
    [params hs_setSafeValue:self.emailTextField.text forKey:@"name"];
    [params hs_setSafeValue:@"" forKey:@"value"];
    
    [self br_progressHUD:YES];
    @weakify(self);
    [BRServiceCenter BRServiceCenterUPDWithAction:@"resetPassword" CMD:[BRCommand CommandResetPassword] params:params response:^(BRMessageResponseType type, NSInteger retryCount, id responseObj) {
        if (responseObj) {
            @strongify(self);
            [self br_progressHUD:NO];
            BRUDPResponse *response = responseObj;
            if ([response.state isEqualToString:@"0000"]) {
                [self br_alertViewWithTitle:@"提示" content:response.stateDesc operationIndex:^(NSInteger clickedIndex) {
                    [self br_dismissViewController];
                }];
            }   else
            {
                [self br_AutoDisappearWithText:response.stateDesc];
            }
        }
    }];
}

@end
